package cn.beatuty.makeup.module.system.dal.mysql.msg;

import java.util.*;

import cn.beatuty.makeup.framework.common.pojo.PageResult;
import cn.beatuty.makeup.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.beatuty.makeup.framework.mybatis.core.mapper.BaseMapperX;
import cn.beatuty.makeup.module.system.controller.admin.msg.vo.MsgPageReqVO;
import cn.beatuty.makeup.module.system.dal.dataobject.msg.MsgDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 评论 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface MsgMapper extends BaseMapperX<MsgDO> {

    default PageResult<MsgDO> selectPage(MsgPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MsgDO>()
                .eqIfPresent(MsgDO::getCommenterId, reqVO.getCommenterId())
                .eqIfPresent(MsgDO::getContent, reqVO.getContent())
                .eqIfPresent(MsgDO::getParentCommentId, reqVO.getParentCommentId())
                .eqIfPresent(MsgDO::getArticleId, reqVO.getArticleId())
                .eqIfPresent(MsgDO::getLikesCount, reqVO.getLikesCount())
                .eqIfPresent(MsgDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MsgDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MsgDO::getId));
    }

}